package com.longxi.tianjintianbao.ui.activity.task;

import android.support.v7.widget.RecyclerView;
import android.widget.Button;
import android.widget.LinearLayout;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.task.TaskDetailAtPresenter;
import com.longxi.tianjintianbao.ui.view.task.ITaskDetailAtView;

import butterknife.BindView;

/**
 * Created by 70339 on 2018/5/3.
 * 代码无八阿哥
 * 阿弥陀佛
 */
public class TaskDetailActivity extends BaseActivity<ITaskDetailAtView, TaskDetailAtPresenter> implements ITaskDetailAtView {
    @BindView(R.id.rvContent)
    RecyclerView mRvContent;

    @BindView(R.id.llState)
    LinearLayout mLlState;
    @BindView(R.id.llCannot)
    LinearLayout mLlCannot;
    @BindView(R.id.btnPause)
    Button mBtnPause;
    @BindView(R.id.btnComplete)
    Button mBtnComplete;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_task_detail;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
        mPresenter.initAdapter();
        mPresenter.setTask();
//        mPresenter.showBtn();
        mBtnComplete.setOnClickListener(v -> mPresenter.btnComplete());
        mLlState.setOnClickListener(v -> mPresenter.showTaskExplainDialogFragment());
        mBtnPause.setOnClickListener(v -> mPresenter.showTaskProgressDialogFragment());
    }

    public void cannotComplete(String explain){
        mPresenter.acceptTask("3", explain);
    }

    public void addTaskProgress(String content){
        mPresenter.addTaskProgress(content);
    }

    @Override
    public void initListener() {
        super.initListener();
    }

    @Override
    protected TaskDetailAtPresenter createPresenter() {
        return new TaskDetailAtPresenter(this);
    }

    @Override
    public RecyclerView getRvContent() {
        return mRvContent;
    }

    @Override
    public LinearLayout getLlState() {
        return mLlState;
    }

    @Override
    public LinearLayout getLlCannot() {
        return mLlCannot;
    }

    @Override
    public Button getBtnPause() {
        return mBtnPause;
    }

    @Override
    public Button getBtnComplete() {
        return mBtnComplete;
    }
}
